<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改实从业人员信息')"/>
    <th:block th:include="include :: jasny-bootstrap-css"/>
    <th:block th:include="include :: datetimepicker-css"/>
    <th:block th:include="include :: ztree-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-staff-edit" th:object="${staff}">
        <input name="id" th:field="*{id}" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label">头像：</label>
            <div class="col-sm-8 fileinput input-group "
                 th:classappend="${photo} ? 'fileinput-exists' : 'fileinput-new'" data-provides="fileinput"
                 style="text-align: center; margin-bottom: 0;">
                <div class="fileinput-preview thumbnail" data-trigger="fileinput"
                     style="width: 200px; height: 150px; margin-right: 10px;">
                    <img th:if="${photo}" th:src="@{'/sys/common/view/' + ${photo}}">
                </div>
                <span class="btn btn-white btn-file"><span class="fileinput-new">选择图片</span><span
                        class="fileinput-exists">更改</span><input name="photo" type="hidden" th:value="${photo}"><input
                        id="williamYe" type="file"></span>
                <a href="#" class="btn btn-white fileinput-exists" data-dismiss="fileinput">清除</a>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">姓名：</label>
            <div class="col-sm-8">
                <input name="xm" th:field="*{xm}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">外文姓：</label>
            <div class="col-sm-8">
                <input name="wwx" th:field="*{wwx}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">外文名：</label>
            <div class="col-sm-8">
                <input name="wwm" th:field="*{wwm}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">身份证：</label>
            <div class="col-sm-8">
                <select name="ywsfzh" class="form-control m-b">
                    <option value="0" th:field="*{ywsfzh}">有</option>
                    <option value="1" th:field="*{ywsfzh}">无</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">公民身份号：</label>
            <div class="col-sm-8">
                <input name="gmsfhm" th:field="*{gmsfhm}" class="form-control" type="text">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">证件种类：</label>
            <div class="col-sm-8">
                <select name="cyzjdm" class="form-control m-b" th:with="type=${@dict.getParamValue('SQJW_ZJZL2')}">
                    <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}"
                            th:field="*{cyzjdm}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">证件号码：</label>
            <div class="col-sm-8">
                <input name="zjhm" th:field="*{zjhm}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">单位名称：</label>
            <div class="col-sm-8">
                <input name="dwmc" th:field="*{dwmc}" class="form-control" type="text" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">职业：</label>
            <div class="col-sm-8">
                <input name="zy" th:field="*{zy}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">职业类别：</label>
            <div class="col-sm-8">
                <input name="zylbdm" th:field="*{zylbdm}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">住址：</label>
            <div class="col-sm-8">
                <input name="zzbm" th:field="*{zzbm}" class="form-control" type="hidden">
                <div class="input-group">
                    <input class="form-control" name="zz" th:field="*{zz}" type="text" onclick="selectAddressTree()"
                           id="treeName" readonly="true">
                    <span class="input-group-addon"><i class="fa fa-search"></i></span>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">联系方式：</label>
            <div class="col-sm-8">
                <input name="lxfs" th:field="*{lxfs}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">重点人员标识：</label>
            <div class="col-sm-8">
                <input name="zdrybz" th:field="*{zdrybz}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">国家地区：</label>
            <div class="col-sm-8">
                <input name="gjdq" th:field="*{gjdq}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">民族：</label>
            <div class="col-sm-8">
                <select name="mz" class="form-control m-b" th:with="type=${@dict.getParamValue('SQJW_MZ')}">
                    <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}"
                            th:field="*{mz}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">户籍地址：</label>
            <div class="col-sm-8">
                <input name="hjdz" th:field="*{hjdz}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">性别：</label>
            <div class="col-sm-8">
                <select name="xbdm" class="form-control m-b" th:with="type=${@dict.getParamValue('SQJW_XB')}">
                    <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}"
                            th:field="*{xbdm}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">出生日期：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input name="csrq" th:value="${#dates.format(staff.csrq, 'yyyy-MM-dd')}" class="form-control"
                           placeholder="yyyy-MM-dd" type="text">
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">人员类别：</label>
            <div class="col-sm-8">
                <input name="rylb" th:field="*{rylb}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">是否境外人员：</label>
            <div class="col-sm-8">
                <input name="sfjwry" th:field="*{sfjwry}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">岗位：</label>
            <div class="col-sm-8">
                <input name="gw" th:field="*{gw}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">标签：</label>
            <div class="col-sm-8">
                <input name="bq" th:value="${bq}" type="hidden">
                <input id="labelName" th:value="${labelNames}" class="form-control" type="text" readonly>
                <div id="tree" class="ztree" style="border: 1px solid #e5e6e7"></div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">登记单位公安机关名称：</label>
            <div class="col-sm-8">
                <input name="djdwGajgmc" th:field="*{djdwGajgmc}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">登记人姓名：</label>
            <div class="col-sm-8">
                <input name="djrXm" th:field="*{djrXm}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">登记时间：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input name="djsj" th:value="${#dates.format(staff.djsj, 'yyyy-MM-dd')}" class="form-control"
                           placeholder="yyyy-MM-dd" type="text">
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">信息登记来源_业务类别：</label>
            <div class="col-sm-8">
                <input name="xxdjlyZaglywlbdm" th:field="*{xxdjlyZaglywlbdm}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">信息注销来源_业务类别：</label>
            <div class="col-sm-8">
                <input name="xxzxlyZaglywlbdm" th:field="*{xxzxlyZaglywlbdm}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">数据来源：</label>
            <div class="col-sm-8">
                <select name="sjly" class="form-control m-b" th:with="type=${@dict.getParamValue('YBSS_SJLY')}">
                    <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}"
                            th:field="*{sjly}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">重点人员类别：</label>
            <div class="col-sm-8">
                <input name="zdrylb" th:field="*{zdrylb}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">核查人员标志：</label>
            <div class="col-sm-8">
                <input name="hcrybz" th:field="*{hcrybz}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">重点人员类别名称：</label>
            <div class="col-sm-8">
                <input name="zdrylbmc" th:field="*{zdrylbmc}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">互联网审核人：</label>
            <div class="col-sm-8">
                <input name="hlwshr" th:field="*{hlwshr}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">互联网审核时间：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input name="hlwshsj" th:value="${#dates.format(staff.hlwshsj, 'yyyy-MM-dd')}" class="form-control"
                           placeholder="yyyy-MM-dd" type="text">
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">所属地市：</label>
            <div class="col-sm-8">
                <input name="ssds" th:field="*{ssds}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">所属社区：</label>
            <div class="col-sm-8">
                <input name="sssq" th:field="*{sssq}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">所属网格：</label>
            <div class="col-sm-8">
                <input name="sswg" th:field="*{sswg}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">注销时间：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input name="zxsj" th:value="${#dates.format(staff.zxsj, 'yyyy-MM-dd')}" class="form-control"
                           placeholder="yyyy-MM-dd" type="text">
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">注销账号：</label>
            <div class="col-sm-8">
                <input name="zxr" th:field="*{zxr}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">注销时间标志：</label>
            <div class="col-sm-8">
                <input name="zxsjbz" th:field="*{zxsjbz}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">注销原因：</label>
            <div class="col-sm-8">
                <input name="zxyy" th:field="*{zxyy}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">更新账号：</label>
            <div class="col-sm-8">
                <input name="gxzh" th:field="*{gxzh}" class="form-control" type="text">
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: ztree-js"/>
<th:block th:include="include :: jasny-bootstrap-js"/>
<th:block th:include="include :: datetimepicker-js"/>
<script type="text/javascript">
    var prefix = ctx + "control/staff";
    $("#form-staff-edit").validate({
        focusCleanup: true
    });

    $(function () {
        var url = ctx + "control/label/treeData";
        var options = {
            id: "tree",
            url: url,
            check: {enable: true},
            expandLevel: 0,
            onCheck: onCheck
        };
        $.tree.init(options);
    });

    function onCheck() {
        $('input[name="bq"]').val(getChecked('id'));
        $('#labelName').val(getChecked('name'));
    }

    function getChecked(column) {
        var nodes = $._tree.getCheckedNodes(true);
        return $.map(nodes, function (row) {
            if (!row.isParent) {
                return row[column]
            }
        }).join();
    }

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-staff-edit').serialize());
        }
    }

    $('#williamYe').on('change.bs.fileinput ', function (e) {
        // 处理自己的业务
        if (this.files[0]) {
            const formData = new FormData();
            formData.append('file', this.files[0]);
            $.operate.fileUpload(formData, $('input[name="photo"]'));
        } else {
            $('input[name="photo"]').val("");
        }
    });

    /*编辑-选择地址树*/
    function selectAddressTree() {
        var url = prefix + "/selectAddressTree";
        var options = {
            title: '住址选择',
            width: "380",
            url: url,
            callBack: doSubmit
        };
        $.modal.openOptions(options);
    }

    function doSubmit(index, layero) {
        var body = layer.getChildFrame('body', index);
        $('input[name="zzbm"]').val(body.find('#treeId').val());
        $("#treeName").val(body.find('#treeName').val());
        layer.close(index);
    }

    $("input[name='csrq']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='djsj']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='hlwshsj']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='zxsj']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });
</script>
</body>
</html>
